import 'package:banyou_app/app/config/colors.dart';
import 'package:banyou_app/app/routes/app_pages.dart';
import 'package:banyou_app/app/widget/app_bar_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';

import '../controllers/kefu_controller.dart';

class KefuView extends GetView<KefuController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          Positioned(
            top: 0,
            left: 0,
            right: 0,
            height: 1.sw * 215 / 375,
            child: Image.asset(
              'assets/images/蒙版组 3@2x.png',
              width: 1.sw,
            ),
          ),
          Positioned(
            top: 180,
            left: 25,
            right: 25,
            height: 185,
            child: Container(
              clipBehavior: Clip.hardEdge,
              decoration: BoxDecoration(
                border: Border.all(color: Color(0x1A131313)),
                color: ColorConfig.white,
                borderRadius: BorderRadius.all(Radius.circular(10.r)),
              ),
              padding: EdgeInsets.symmetric(horizontal: 30, vertical: 30),
              child: Column(
                children: [
                  Row(
                    children: [
                      Container(
                          child: Image.asset(
                        'assets/images/聊天客服.png',
                        width: 40,
                        fit: BoxFit.cover,
                        height: 40,
                      )),
                      SizedBox(width: 10),
                      Column(
                        mainAxisAlignment: MainAxisAlignment.start,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text("客服电话",
                              style: TextStyle(
                                  color: ColorConfig.text_label,
                                  fontWeight: FontWeight.bold,
                                  fontSize: 14)),
                          SizedBox(height: 10),
                          Obx(() => Text(controller.kefu.value,
                              style: TextStyle(
                                  color: Color(0xFF959595),
                                  fontWeight: FontWeight.bold,
                                  fontSize: 14))),
                        ],
                      )
                    ],
                  ),
                  const SizedBox(height: 30),
                  InkWell(
                    child: Container(
                      padding: EdgeInsets.symmetric(horizontal: 26),
                      height: 45,
                      decoration: BoxDecoration(
                        gradient: LinearGradient(
                            begin: Alignment.centerLeft,
                            end: Alignment.centerRight,
                            colors: [
                              Color(0xFFF52EC5),
                              Color(0xFFFF8A33),
                            ]),
                        borderRadius: BorderRadius.circular(20),
                      ),
                      child: Center(
                        child: Text(
                          "在线服务",
                          style: TextStyle(
                              color: ColorConfig.white,
                              fontSize: 16,
                              fontWeight: FontWeight.w500),
                        ),
                      ),
                    ),
                    onTap: () {
                      Get.toNamed(Routes.CHAT);
                    },
                  ),
                ],
              ),
            ),
          ),
          Positioned(
            top: 0,
            left: 0,
            right: 0,
            height: 60,
            child: AppBarWidget(
              titleStr: '客服',
              backgroundColor: Colors.transparent,
            ),
          ),
        ],
      ),
    );
  }
}
